]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
window-clone: Fix signal connections when the window is closed
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 3 Feb 2011 18:25:59 +0000 (19:25 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 3 Feb 2011 18:38:57 +0000 (19:38 +0100)
Commit 91d8a32f25 let WindowClone forward the size-changed signal
of the "real" window, disconnecting the signal handler when the
clone is destroyed. In case the clone was destroyed due to the
MetaWindowActor being closed, this results in a warning
(gsignal.c:2392: instance `0x2a3fac0' has no handler with id `2955').

Handle the case where the original window is destroyed before its
clone.

js/ui/workspace.js

index cf3feb5c91cb286afc39f06bbb3a7536ca552bf8..ebb3f1e9f86d8ab29ce4109a60b0f6877c17d854 100644 (file)
@@ -107,6 +107,8 @@ WindowClone.prototype = {
         this._sizeChangedId = this.realWindow.connect('size-changed', Lang.bind(this, function() {
             this.emit('size-changed');
         }));
+        this._realWindowDestroyId = this.realWindow.connect('destroy',
+            Lang.bind(this, this._disconnectRealWindowSignals));
 
         this.actor.connect('button-release-event',
                            Lang.bind(this, this._onButtonRelease));
@@ -160,10 +162,19 @@ WindowClone.prototype = {
         }
     },
 
-    _onDestroy: function() {
-        this.realWindow.disconnect(this._sizeChangedId);
+    _disconnectRealWindowSignals: function() {
+        if (this._sizeChangedId > 0)
+            this.realWindow.disconnect(this._sizeChangedId);
         this._sizeChangedId = 0;
 
+        if (this._realWindowDestroyId > 0)
+            this.realWindow.disconnect(this._realWindowDestroyId);
+        this._realWindowDestroyId = 0;
+    },
+
+    _onDestroy: function() {
+        this._disconnectRealWindowSignals();
+
         this.metaWindow._delegate = null;
         this.actor._delegate = null;
         if (this._zoomLightbox)